/*******************************************************************************
 * Copyright (c) 2007 University of Oslo.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     University of Oslo - initial API and implementation
 *******************************************************************************/

package com.cea.papyrus.diagram.sequence.sedi.figures;

import org.eclipse.draw2d.FigureListener;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.geometry.Rectangle;

/**
 * Contributes anchorMap to an AnchoringFigure.
 * 
 * @author frankd@ifi.uio.no
 */ 
public interface AnchorContributor { 
	
	/** 
	 * Gives the start.y and height bounds for the area, relative to the
	 * coordinate system of the given figure, where the contributor 
	 * has an effect.
	 */
	Rectangle getAnchorContributionBounds(IFigure figure);
	
	/**
	 * Gives the x coordinate part of contributed anchors.
	 * 
	 * @param figure
	 *     The figure that will receive the anchors
	 * @param y
	 *     The y-coordinate of the anchor. The contributor might
	 *     use this information to decide more precisely which
	 *     anchors it want to contribute.
	 * 
	 * @return x-coordinates of contributed anchor.
	 * 
	 * @see #NO_CONTRIBUTIONS
	 */
	int[] contributeAnchors(IFigure figure, int y);
	
	final static int[] NO_CONTRIBUTIONS = new int[0];

	AnchorPolicy getAnchorPolicy();

	// A Contributor may sometimes be moved, in which case it may
	// affect their contributed anchors. Therefore we need 
	// some methods from IFigure as well:
	void addFigureListener(FigureListener listener);
	void removeFigureListener(FigureListener listener);	
}

